package com.heima.wemedia.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.wemedia.mapper.WmChannelMapper;
import com.heima.wemedia.service.ChannelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 频道信息表 服务实现类
 * </p>
 *
 * @author kk
 */
@Slf4j
@Service
@Transactional
public class ChannelServiceImpl extends ServiceImpl<WmChannelMapper,WmChannel> implements ChannelService {
    //查询所有频道
    @Override
    public ResponseResult findAll() {
        LambdaQueryWrapper<WmChannel> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByDesc(WmChannel::getCreatedTime);//排序
        List<WmChannel> list = list(queryWrapper);
        return ResponseResult.okResult(list);
    }
}
